#include <iostream>
using namespace std;

/*
    【题目215】定义一个基类有姓名、性别、年龄，再由基类派生出教师类和学生类，教师
    类增加工号、职称和工资，学生类增加学号、班级、专业和入学成绩。
*/

class Person
{
public:
    Person(string name, string sex, int age)
    {
        this->name = name;
        this->sex = sex;
        this->age = age;
    }
    string name;
    string sex;
    int age;
};

class Teacher : public Person
{
public:
    Teacher(string name, string sex, int age, string id, string title, double salary) : Person(name, sex, age)
    {
        this->id = id;
        this->title = title;
        this->salary = salary;
    }
    void show()
    {
        cout << "姓名：" << name << endl;
        cout << "性别：" << sex << endl;
        cout << "年龄：" << age << endl;
        cout << "工号：" << id << endl;
        cout << "职称：" << title << endl;
        cout << "工资：" << salary << endl;
    }

private:
    string id;
    string title;
    double salary;
};

class Student : public Person
{
public:
    Student(string name, string sex, int age, string id, string class_name, string major, double score) : Person(name, sex, age)
    {
        this->id = id;
        this->class_name = class_name;
        this->major = major;
        this->score = score;
    }

    void show()
    {
        cout << "姓名：" << name << endl;
        cout << "性别：" << sex << endl;
        cout << "年龄：" << age << endl;
        cout << "学号：" << id << endl;
        cout << "班级：" << class_name << endl;
        cout << "专业：" << major << endl;
        cout << "成绩：" << score << endl;
    }

private:
    string id;
    string class_name;
    string major;
    double score;
};

int main()
{
    Student s("张三", "男", 20, "20210001", "计算机科学与技术", "1班", 90);
    Teacher t("李四", "男", 35, "20210002", "副教授", 10000);
    s.show();
    t.show();
}
